<#include '/admin/header.html' >
<style>
 td .layui-btn{
  background:#1E9FFF;
  }
</style>
<div  class="admin-main">
   <div>
        <!--提示区域  -->
        <div class="page_explain">
           <h2>操作提示</h2>
            <ul>
                <li><span>·</span>可以对上架货品进行库存维护，对不同商品，和不同仓库进行操作。</li>
                <li><span>·</span>后台设置菜单，可以去仓库管理里面添加仓库，和修改默认仓库。</li>
            </ul>
        </div>
        <!--按钮操作  -->
        <div class="table_control">
            <div class="table_opera">
                <button type="button" title="提示" class="layui-btn layui-btn-primary " id="explain">
                    <i class="icon iconfont icon-tishi1"></i>
                </button>
            </div>
            <!--搜索区域  -->
            <div class="table_search">
                <input type="text" id="searchKeyWord" style="height:25px;width: 250px;" placeholder="请输入商品名称,编号">
                <button type="button" class="layui-btn layui-btn-primary layui-btn-small" style="margin: 0px 9px 10px 0px;" onclick="searchWarnGoodsStore()"><i class="layui-icon">&#xe615;</i></button>
            </div>
            <div style="background-color: white; display:none;" class="searchAdvanced">
				<input id="Advanced" name="Advanced" type="hidden" value="0" />
				<input id="depotid" name="depotid" type="hidden" value="0" />
				<table width="98%" border="0" cellspacing="0" cellpadding="8">
					<tr>
						<td width="70" align="right">商品编号</td>
						<td><input type="text" value="" id="sn" class="input_text"></td>
						<td width="70" align="right">商品名称</td>
						<td><input type="text" value="" id="name" class="input_text"></td>
						<td width="70" align="right"></td>
						<td><a id="searchAdvance" class="button blueButton" onclick="searchWarnGoodsStore()" href="javascript:;">开始搜索</a></td>
					</tr>
				</table>
			</div>            
        </div>
   </div>
   <!--表格区域  -->
   <form id="advform">
    <table id="goodsstoredata" class="layui-table site-table table-hover" width="100%" lay-skin="line">
        <thead>
        <tr>
            <th>商品编号</th>
            <th>商品名称</th>
            <th>分类</th>
            <th>操作</th>
        </tr>
        </thead>
    </table>
    <!--传值等操作(暂定)  -->
    <div id="addBrand" ></div>
   </form>
</div>
<!--js区域  -->
<script>
$.fn.dataTable.ext.errMode = 'none';
var table;
$(function(){
	
	table = $('#goodsstoredata').DataTable({
		"language": {
	        "url": "${staticserver}/media/zh_CN.txt"
	    },
	    "processing": true,
	    "serverSide": true, 
	    "ordering": false,
	    "searching": false,
	    "lengthChange": false,
	    ajax: {
	        //指定数据源
	        type:"post",
	        url: '${ctx}/shop/admin/goods-warning-store/list-goods-store-json.do',
	    },
	    columns: [ //定义列
	        {data: "sn"},
	        {data: "name"},
	        {data: "cname"},
	        {data: null,"render": function(data, type, row) {
	        	return "<a class='layui-btn layui-btn-small _aa' name='change_btn' onclick=\"view("+data.goods_id+")\">操作</a>";		//获取值:data["brand_id"]
	       	}}
	     ]
	});
});

//搜索
function searchWarnGoodsStore(){
	var stype = $("#Advanced").val();
	var keyword = $("#searchKeyWord").val();
	var name = $('#name').val();
	var sn = $('#sn').val();
	var depotid=$("#depotid").val();
	var param = "stype="+stype+"&keyword="+keyword+"&name="+name+"&sn="+sn+"&depotid="+depotid;
	var url = table.ajax.url(ctx+"/shop/admin/goods-warning-store/list-goods-store-json.do?"+param);
	url.load();
}


//维护操作
function view(goodsid){
	layer.open({
        title:"维护",//标题
        maxmin :true,//右上角可否放大缩小
        offset: '100px',//弹框位置
        type:2,//弹框的类型
        shade: [0.3, '#000'],//黑色背景
        shadeClose:false,//黑色背景是否可以点击关闭
        content:ctx+"/shop/admin/goods-warning-store/get-warning-store-dialog-html.do?goodsid="+goodsid,//内容的URL
        area:['600px','350px'],//弹框大小
        scrollbar: false//是否允许浏览器出现滚动条
    });
}

</script>
<#include '/admin/footer.html' >
